package com.nbsaas.boot.shop.rest.convert;

import com.nbsaas.boot.shop.data.entity.ShopApp;
import com.nbsaas.boot.shop.api.domain.simple.ShopAppSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class ShopAppSimpleConvert implements Converter<ShopAppSimple, ShopApp> {




@Override
public ShopAppSimple convert(ShopApp source) {
    ShopAppSimple result = new ShopAppSimple();

                result.setSummary(source.getSummary());

               try {
                   if(source.getShop()!=null){
                       result.setShop(source.getShop().getId());
                   }
                } catch (Exception ignored) { }

                result.setName(source.getName());
                result.setIcon(source.getIcon());

                try {
                    if(source.getShop()!=null){
                        result.setShopName(source.getShop().getName());
                    }
                } catch (Exception ignored) { }

                result.setSortNum(source.getSortNum());

               try {
                   if(source.getStaff()!=null){
                       result.setStaff(source.getStaff().getId());
                   }
                } catch (Exception ignored) { }

                result.setId(source.getId());
                result.setAddDate(source.getAddDate());
                result.setUrl(source.getUrl());
                result.setLastDate(source.getLastDate());


    return result;
}

}